// database/models/student.go
package models

import (
	"hero/database"
	"time"
)

// User 模型
type Student struct {
	ID       int       `json:"id" gorm:"primary_key"`
	Name     string    `json:"name"`
	Age      int       `json:"age"`
	Birthday time.Time `json:"birthday"`
}

func (s *Student) GetList() []Student {
	db, err := database.GetDb()
	if err != nil {
		panic(err)
	}
	var students []Student
	db.Conn.Find(&students).Where("id > 0").Order("id desc").Limit(20)
	return students

}
